package workspace;

import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream.GetField;

import org.apache.log4j.Logger;

import com.nsn.vs.sdm.component.svn.SvnClientManager;


public class MakeWorkFolders {
	private static final Logger LOGGER = Logger.getLogger(SvnClientManager.class);
	/**
	 * WorkspacePath
	 */
	private String WorkspacePath;
	private final String adaptPath="adaptDir";
	private final String cFile="cFile";
	private final String compDescr="compDescr";
	private final String compDescrDepth="descriptors";
	public MakeWorkFolders(String workspacePath)
	{
		this.WorkspacePath=System.getProperty("user.dir")+File.separator+workspacePath;
	}
	
//	/**
//	 * set workspace path 
//	 * @param WorkspacePath
//	 */
//	public void setWorkspacePath( String WorkspacePath)
//	{
//		this.WorkspacePath=WorkspacePath;
//	}
	/**
	 * mk workspace dir and return the path
	 * @return WorkspacePath
	 * @throws IOException
	 */
	public String getWorkspacePath()throws IOException
	{	File f=new File(this.WorkspacePath);
		if (f.exists()){
			f.delete();
		}
		else{
			LOGGER.info("creat workspace: "+this.WorkspacePath);
			f.mkdir();
		}
		return this.WorkspacePath;
	}
	/**
	 * 
	 * @return 
	 * @throws IOException
	 */
	public String getCFilePath()throws IOException
	{	
		File f=new File(this.WorkspacePath+File.separator+this.cFile);
		f.mkdir();
		return this.WorkspacePath+File.separator+this.cFile;
	}
	public static void main(String []args)throws IOException
	{
		MakeWorkFolders test= new  MakeWorkFolders("NTHLRFE");
		System.out.println(test.getWorkspacePath());
		System.out.println(test.getCFilePath());
		
	}
}
